home *** CD-ROM | disk | FTP | other *** search
/ Backpacker 2 (Sweden) / BackPacker 2 (Sweden) (Disc 1).7z / BackPacker 2 (Sweden) (Disc 1).bin / pc / instdata / instin04 / 00023_read - write-scripts.ls < prev    next >
Encoding:
Text File  |  1997-01-01  |  2.0 KB  |  85 lines

  1. on skrivHost
  2.   play frame "sendHost"
  3. end
  4.  
  5. on skrivChat
  6.   play frame "sendChat"
  7. end
  8.  
  9. on skrivGame
  10.   play frame "sendGame"
  11. end
  12.  
  13. on checkOut
  14.   play frame "loggaAv"
  15. end
  16.  
  17. on nyttSpel
  18.   play frame "newGame"
  19. end
  20.  
  21. on readOpponents
  22.   global gFileList, gPulledLength, gOppPull, gHost, gHit, gPulledOff, gOppName, gReleased, gForlust, gPaperLeft
  23.   readFile()
  24.   if count(gFileList) = 0 then
  25.     set whatIWant to -1
  26.   else
  27.     set msgID to EMPTY
  28.     set msgType to EMPTY
  29.     set tabs to 0
  30.     set data to getAt(gFileList, 1)
  31.     deleteAt(gFileList, 1)
  32.     repeat with i = 1 to length(data)
  33.       if char i of data = TAB then
  34.         set tabs to tabs + 1
  35.       end if
  36.       if tabs = 4 then
  37.         put char i + 1 of data after msgID
  38.       end if
  39.       if tabs = 5 then
  40.         put char i + 1 of data after msgType
  41.       end if
  42.       if tabs = 7 then
  43.         exit repeat
  44.       end if
  45.     end repeat
  46.     set msgID to value(chars(msgID, 1, length(msgID) - 1))
  47.     set msgType to value(chars(msgType, 1, length(msgType) - 1))
  48.     set chatData to chars(data, i + 1, length(data) - 1)
  49.     set data to value(chars(data, i + 1, length(data) - 1))
  50.     if (msgType > 9) or (msgType < 0) then
  51.       set whatIWant to -1
  52.     else
  53.       if msgID = 2 then
  54.         set gPulledOff to getAt(data, 1)
  55.         set gHit to getAt(data, 2)
  56.         set gReleased to getAt(data, 3)
  57.         set gOppPull to getAt(data, 4)
  58.         set gPulledLength to getAt(data, 5)
  59.         set gForlust to getAt(data, 6)
  60.         set gPaperLeft to getAt(data, 7)
  61.         set whatIWant to msgID
  62.       else
  63.         if msgID = 1 then
  64.           doChat(string(chatData))
  65.           set whatIWant to msgID
  66.         else
  67.           if msgID = 3 then
  68.             if gHost = 0 then
  69.               set gPaperLeft to data
  70.             end if
  71.             set whatIWant to msgID
  72.           else
  73.             if msgID = 6 then
  74.               set data to gOppName & " has quit the game!"
  75.               doChat(data)
  76.               set whatIWant to msgID
  77.             end if
  78.           end if
  79.         end if
  80.       end if
  81.     end if
  82.   end if
  83.   return whatIWant
  84. end
  85.